<?php

namespace Sofical\Restphp\utils;

/**
 * Interceptor manage.
 */
class RestInterceptManage {
    /**
     * Register interceptor.
     * @param $className
     * @param $methodName
     * @return void
     */
    public static function register($className, $methodName) {
        $GLOBALS['_INTERCEPT'] = isset($GLOBALS['_INTERCEPT']) ? $GLOBALS['_INTERCEPT'] : array();

        $GLOBALS['_INTERCEPT'][] = array(
            'class' => $className,
            'function' => $methodName
        );
    }

    /**
     * Get interceptors.
     * @return array
     */
    public static function getInterceptors() {
        return isset($GLOBALS['_INTERCEPT']) ? $GLOBALS['_INTERCEPT'] : array();
    }
}